using System;
using System.Collections.Generic;

using Microsoft.Xna.Framework;

using Elephant.Framework.Services;

using Elephant.Utility;
using Elephant.Utility.Components;

namespace UsingMaterials
{
    public class LambertMaterial : Material
    {
        public override void LoadGraphicsContent(bool loadAllContent)
        {
            IContentService content = GameHelper.GetService<IContentService>();

            Effect = content.Load<Microsoft.Xna.Framework.Graphics.Effect>("Content\\Effects\\Lambert");
            Effect.CurrentTechnique = Effect.Techniques["diffuse"];
        }

        public Vector4 AmbientColor
        {
            get
            {
                return Effect.Parameters["ambiColor"].GetValueVector4();
            }
            set
            {
                Effect.Parameters["ambiColor"].SetValue(
                    value);
            }
        }

        public Matrix World
        {
            get
            {
                return Effect.Parameters["world"].GetValueMatrix();
            }
            set
            {
                Effect.Parameters["world"].SetValue(
                    value);
            }
        }

        public Matrix WorldViewProjection
        {
            get
            {
                return Effect.Parameters["wvp"].GetValueMatrix();
            }
            set
            {
                Effect.Parameters["wvp"].SetValue(
                    value);
            }
        }

        public Matrix WorldInverse
        {
            get
            {
                return Effect.Parameters["worldIT"].GetValueMatrix();
            }
            set
            {
                Effect.Parameters["worldIT"].SetValueTranspose(
                    value);
            }
        }

        public Matrix ViewInverse
        {
            get
            {
                return Effect.Parameters["viewInvTrans"].GetValueMatrix();
            }
            set
            {
                Effect.Parameters["viewInvTrans"].SetValueTranspose(
                    value);
            }
        }
    }
}
